<template>
  <div class="app-container">
    <!-- 顶部导航栏 -->
    <nav class="nav-bar">
      <div class="logo">
        <router-link to="/">
          <img src="/logo.png" alt="艺标图映" class="logo-image">
        </router-link>
      </div>
      <div class="nav-links">
        <router-link
          v-for="item in navItems"
          :key="item.path"
          :to="item.path"
          class="nav-link"
          :class="{ active: currentPath === item.path }"
        >
          {{ item.name }}
        </router-link>
      </div>
    </nav>

    <!-- 主要内容区域 -->
    <main class="main-content">
      <router-view v-slot="{ Component }">
        <transition name="fade" mode="out-in">
          <component :is="Component" />
        </transition>
      </router-view>
    </main>
  </div>
</template>

<script setup>
import { ref, computed } from 'vue'
import { useRoute } from 'vue-router'

const route = useRoute()
const currentPath = computed(() => route.path)

const navItems = ref([
  { name: '主页', path: '/' },
  { name: '艺标展区', path: '/projects' },
  { name: '艺标画板', path: '/model' },
  { name: '艺标文生图', path: '/text-to-image' },
  { name: '艺标工作流', path: '/workflow' }
])
</script>

<style scoped>
.app-container {
  min-height: 100vh;
  background-color: #ffffff;
}

.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 50px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

.logo {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0px 0;
}

.logo-image {
  height: 100%;
  width: auto;
  object-fit: contain;
  max-height: 85px;
}

.nav-links {
  display: flex;
  gap: 40px;
  margin-left: auto;
}

.nav-link {
  text-decoration: none;
  color: #333;
  font-size: 16px;
  font-weight: 500;
  padding: 8px 0;
  position: relative;
  transition: all 0.3s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #7B66FF;
  transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

.nav-link.active {
  color: #7B66FF;
}

.main-content {
  padding-top: 50px;
  min-height: calc(100vh - 70px);
}

.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}

@media (max-width: 768px) {
  .nav-bar {
    padding: 0 20px;
  }

  .nav-links {
    gap: 15px;
  }

  .nav-link {
    font-size: 14px;
  }

  .logo-image {
    max-height: 40px;
  }
}
</style>
